home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / make-367.lha / make-3.67 / configure < prev    next >
Text File  |  1993-05-22  |  50KB  |  1,881 lines

  1. #!/bin/sh
  2. # Guess values for system-dependent variables and create Makefiles.
  3. # Generated automatically using autoconf.
  4. # Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.
  5.  
  6. # This program is free software; you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation; either version 2, or (at your option)
  9. # any later version.
  10.  
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. # GNU General Public License for more details.
  15.  
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program; if not, write to the Free Software
  18. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19.  
  20. # Usage: configure [--srcdir=DIR] [--host=HOST] [--gas] [--nfp] [--no-create]
  21. #        [--prefix=PREFIX] [--exec-prefix=PREFIX] [--with-PACKAGE] [TARGET]
  22. # Ignores all args except --srcdir, --prefix, --exec-prefix, --no-create, and
  23. # --with-PACKAGE unless this script has special code to handle it.
  24.  
  25.  
  26. for arg
  27. do
  28.   # Handle --exec-prefix with a space before the argument.
  29.   if test x$next_exec_prefix = xyes; then exec_prefix=$arg; next_exec_prefix=
  30.   # Handle --host with a space before the argument.
  31.   elif test x$next_host = xyes; then next_host=
  32.   # Handle --prefix with a space before the argument.
  33.   elif test x$next_prefix = xyes; then prefix=$arg; next_prefix=
  34.   # Handle --srcdir with a space before the argument.
  35.   elif test x$next_srcdir = xyes; then srcdir=$arg; next_srcdir=
  36.   else
  37.     case $arg in
  38.      # For backward compatibility, also recognize exact --exec_prefix.
  39.      -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* | --exec=* | --exe=* | --ex=* | --e=*)
  40.     exec_prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;;
  41.      -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- | --exec | --exe | --ex | --e)
  42.     next_exec_prefix=yes ;;
  43.  
  44.      -gas | --gas | --ga | --g) ;;
  45.  
  46.      -host=* | --host=* | --hos=* | --ho=* | --h=*) ;;
  47.      -host | --host | --hos | --ho | --h)
  48.     next_host=yes ;;
  49.  
  50.      -nfp | --nfp | --nf) ;;
  51.  
  52.      -no-create | --no-create | --no-creat | --no-crea | --no-cre | --no-cr | --no-c | --no- | --no)
  53.         no_create=1 ;;
  54.  
  55.      -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
  56.     prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;;
  57.      -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
  58.     next_prefix=yes ;;
  59.  
  60.      -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=* | --s=*)
  61.     srcdir=`echo $arg | sed 's/[-a-z_]*=//'` ;;
  62.      -srcdir | --srcdir | --srcdi | --srcd | --src | --sr | --s)
  63.     next_srcdir=yes ;;
  64.  
  65.      -with-* | --with-*)
  66.        package=`echo $arg|sed 's/-*with-//'`
  67.        # Delete all the valid chars; see if any are left.
  68.        if test -n "`echo $package|sed 's/[-a-zA-Z0-9_]*//g'`"; then
  69.          echo "configure: $package: invalid package name" >&2; exit 1
  70.        fi
  71.        eval "with_`echo $package|sed s/-/_/g`=1" ;;
  72.  
  73.      -v | -verbose | --verbose | --verbos | --verbo | --verb | --ver | --ve | --v)
  74.        verbose=yes ;;
  75.  
  76.      *) ;;
  77.     esac
  78.   fi
  79. done
  80.  
  81. trap 'rm -f conftest* core; exit 1' 1 3 15
  82.  
  83. # Needed for some versions of `tr' so that character classes in `[]' work.
  84. if test "${LANG+set}" = "set" ; then
  85.    LANG=C
  86. fi
  87.  
  88. rm -f conftest*
  89. compile='${CC-cc} $CFLAGS $DEFS conftest.c -o conftest $LIBS >/dev/null 2>&1'
  90.  
  91. # A filename unique to this package, relative to the directory that
  92. # configure is in, which we can look for to find out if srcdir is correct.
  93. unique_file=vpath.c
  94.  
  95. # Find the source files, if location was not specified.
  96. if test -z "$srcdir"; then
  97.   srcdirdefaulted=yes
  98.   # Try the directory containing this script, then `..'.
  99.   prog=$0
  100.   confdir=`echo $prog|sed 's%/[^/][^/]*$%%'`
  101.   test "X$confdir" = "X$prog" && confdir=.
  102.   srcdir=$confdir
  103.   if test ! -r $srcdir/$unique_file; then
  104.     srcdir=..
  105.   fi
  106. fi
  107. if test ! -r $srcdir/$unique_file; then
  108.   if test x$srcdirdefaulted = xyes; then
  109.     echo "configure: Can not find sources in \`${confdir}' or \`..'." 1>&2
  110.   else
  111.     echo "configure: Can not find sources in \`${srcdir}'." 1>&2
  112.   fi
  113.   exit 1
  114. fi
  115. # Preserve a srcdir of `.' to avoid automounter screwups with pwd.
  116. # But we can't avoid them for `..', to make subdirectories work.
  117. case $srcdir in
  118.   .|/*|~*) ;;
  119.   *) srcdir=`cd $srcdir; pwd` ;; # Make relative path absolute.
  120. esac
  121.         
  122.  
  123. # We want these before the checks, so the checks can modify their values.
  124. test -z "$CFLAGS" && CFLAGS=-g 
  125. test -z "$LDFLAGS" && LDFLAGS=-g 
  126.  
  127. if test -z "$CC"; then
  128.   # Extract the first word of `gcc', so it can be a program name with args.
  129.   set dummy gcc; word=$2
  130.   echo checking for $word
  131.   IFS="${IFS=     }"; saveifs="$IFS"; IFS="${IFS}:"
  132.   for dir in $PATH; do
  133.     test -z "$dir" && dir=.
  134.     if test -f $dir/$word; then
  135.       CC="gcc"
  136.       break
  137.     fi
  138.   done
  139.   IFS="$saveifs"
  140. fi
  141. test -z "$CC" && CC="cc"
  142. test -n "$CC" -a -n "$verbose" && echo "    setting CC to $CC"
  143.  
  144. # Find out if we are using GNU C, under whatever name.
  145. cat > conftest.c <<EOF
  146. #ifdef __GNUC__
  147.   yes
  148. #endif
  149. EOF
  150. ${CC-cc} -E conftest.c > conftest.out 2>&1
  151. if egrep yes conftest.out >/dev/null 2>&1; then
  152.   GCC=1 # For later tests.
  153. fi
  154. rm -f conftest*
  155.  
  156. # Make sure to not get the incompatible SysV /etc/install and
  157. # /usr/sbin/install, which might be in PATH before a BSD-like install,
  158. # or the SunOS /usr/etc/install directory, or the AIX /bin/install,
  159. # or the AFS install, which mishandles nonexistent args, or
  160. # /usr/ucb/install on SVR4, which tries to use the nonexistent group
  161. # `staff'.  On most BSDish systems install is in /usr/bin, not /usr/ucb
  162. # anyway.  Sigh.
  163. if test "z${INSTALL}" = "z" ; then
  164.   echo checking for install
  165.   IFS="${IFS=     }"; saveifs="$IFS"; IFS="${IFS}:"
  166.   for dir in $PATH; do
  167.     test -z "$dir" && dir=.
  168.     case $dir in
  169.     /etc|/usr/sbin|/usr/etc|/usr/afsws/bin|/usr/ucb) ;;
  170.     *)
  171.       if test -f $dir/installbsd; then
  172.     INSTALL="$dir/installbsd -c" # OSF1
  173.     INSTALL_PROGRAM='$(INSTALL)'
  174.     INSTALL_DATA='$(INSTALL) -m 644'
  175.     break
  176.       fi
  177.       if test -f $dir/install; then
  178.     if grep dspmsg $dir/install >/dev/null 2>&1; then
  179.       : # AIX
  180.     else
  181.       INSTALL="$dir/install -c"
  182.       INSTALL_PROGRAM='$(INSTALL)'
  183.       INSTALL_DATA='$(INSTALL) -m 644'
  184.       break
  185.     fi
  186.       fi
  187.       ;;
  188.     esac
  189.   done
  190.   IFS="$saveifs"
  191. fi
  192. INSTALL=${INSTALL-cp}
  193. INSTALL_PROGRAM=${INSTALL_PROGRAM-'$(INSTALL)'}
  194. INSTALL_DATA=${INSTALL_DATA-'$(INSTALL)'}
  195.  
  196. if test -z "$RANLIB"; then
  197.   # Extract the first word of `ranlib', so it can be a program name with args.
  198.   set dummy ranlib; word=$2
  199.   echo checking for $word
  200.   IFS="${IFS=     }"; saveifs="$IFS"; IFS="${IFS}:"
  201.   for dir in $PATH; do
  202.     test -z "$dir" && dir=.
  203.     if test -f $dir/$word; then
  204.       RANLIB="ranlib"
  205.       break
  206.     fi
  207.   done
  208.   IFS="$saveifs"
  209. fi
  210. test -z "$RANLIB" && RANLIB=":"
  211. test -n "$RANLIB" -a -n "$verbose" && echo "    setting RANLIB to $RANLIB"
  212.  
  213. echo checking how to run the C preprocessor
  214. if test -z "$CPP"; then
  215.   CPP='${CC-cc} -E'
  216.   cat > conftest.c <<EOF
  217. #include <stdio.h>
  218. EOF
  219. err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
  220. if test -z "$err"; then
  221.   :
  222. else
  223.   CPP=/lib/cpp
  224. fi
  225. rm -f conftest*
  226. fi
  227.             echo checking for AIX
  228. cat > conftest.c <<EOF
  229. #ifdef _AIX
  230.   yes
  231. #endif
  232.  
  233. EOF
  234. eval "$CPP \$DEFS conftest.c > conftest.out 2>&1"
  235. if egrep "yes" conftest.out >/dev/null 2>&1; then
  236.   {
  237. test -n "$verbose" && \
  238. echo '    defining' _ALL_SOURCE
  239. DEFS="$DEFS -D_ALL_SOURCE=1"
  240. SEDDEFS="${SEDDEFS}\${SEDdA}_ALL_SOURCE\${SEDdB}_ALL_SOURCE\${SEDdC}1\${SEDdD}
  241. \${SEDuA}_ALL_SOURCE\${SEDuB}_ALL_SOURCE\${SEDuC}1\${SEDuD}
  242. \${SEDeA}_ALL_SOURCE\${SEDeB}_ALL_SOURCE\${SEDeC}1\${SEDeD}
  243. "
  244. }
  245.  
  246. fi
  247. rm -f conftest*
  248.  
  249.  
  250. echo checking for POSIXized ISC
  251. if test -d /etc/conf/kconfig.d &&
  252.   grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1
  253. then
  254.   ISC=1 # If later tests want to check for ISC.
  255.   {
  256. test -n "$verbose" && \
  257. echo '    defining' _POSIX_SOURCE
  258. DEFS="$DEFS -D_POSIX_SOURCE=1"
  259. SEDDEFS="${SEDDEFS}\${SEDdA}_POSIX_SOURCE\${SEDdB}_POSIX_SOURCE\${SEDdC}1\${SEDdD}
  260. \${SEDuA}_POSIX_SOURCE\${SEDuB}_POSIX_SOURCE\${SEDuC}1\${SEDuD}
  261. \${SEDeA}_POSIX_SOURCE\${SEDeB}_POSIX_SOURCE\${SEDeC}1\${SEDeD}
  262. "
  263. }
  264.  
  265.   if test -n "$GCC"; then
  266.     CC="$CC -posix"
  267.   else
  268.     CC="$CC -Xp"
  269.   fi
  270. fi
  271.  
  272. echo checking for minix/config.h
  273. cat > conftest.c <<EOF
  274. #include <minix/config.h>
  275. EOF
  276. err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
  277. if test -z "$err"; then
  278.   MINIX=1
  279. fi
  280. rm -f conftest*
  281.  
  282. # The Minix shell can't assign to the same variable on the same line!
  283. if test -n "$MINIX"; then
  284.   {
  285. test -n "$verbose" && \
  286. echo '    defining' _POSIX_SOURCE
  287. DEFS="$DEFS -D_POSIX_SOURCE=1"
  288. SEDDEFS="${SEDDEFS}\${SEDdA}_POSIX_SOURCE\${SEDdB}_POSIX_SOURCE\${SEDdC}1\${SEDdD}
  289. \${SEDuA}_POSIX_SOURCE\${SEDuB}_POSIX_SOURCE\${SEDuC}1\${SEDuD}
  290. \${SEDeA}_POSIX_SOURCE\${SEDeB}_POSIX_SOURCE\${SEDeC}1\${SEDeD}
  291. "
  292. }
  293.  
  294.   {
  295. test -n "$verbose" && \
  296. echo '    defining' _POSIX_1_SOURCE to be '2'
  297. DEFS="$DEFS -D_POSIX_1_SOURCE=2"
  298. SEDDEFS="${SEDDEFS}\${SEDdA}_POSIX_1_SOURCE\${SEDdB}_POSIX_1_SOURCE\${SEDdC}2\${SEDdD}
  299. \${SEDuA}_POSIX_1_SOURCE\${SEDuB}_POSIX_1_SOURCE\${SEDuC}2\${SEDuD}
  300. \${SEDeA}_POSIX_1_SOURCE\${SEDeB}_POSIX_1_SOURCE\${SEDeC}2\${SEDeD}
  301. "
  302. }
  303.  
  304.   {
  305. test -n "$verbose" && \
  306. echo '    defining' _MINIX
  307. DEFS="$DEFS -D_MINIX=1"
  308. SEDDEFS="${SEDDEFS}\${SEDdA}_MINIX\${SEDdB}_MINIX\${SEDdC}1\${SEDdD}
  309. \${SEDuA}_MINIX\${SEDuB}_MINIX\${SEDuC}1\${SEDuD}
  310. \${SEDeA}_MINIX\${SEDeB}_MINIX\${SEDeC}1\${SEDeD}
  311. "
  312. }
  313.  
  314. fi
  315.  
  316. echo checking for ANSI C header files
  317. cat > conftest.c <<EOF
  318. #include <stdlib.h>
  319. #include <stdarg.h>
  320. #include <string.h>
  321. #include <float.h>
  322. EOF
  323. err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
  324. if test -z "$err"; then
  325.   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
  326. echo '#include <string.h>' > conftest.c
  327. eval "$CPP \$DEFS conftest.c > conftest.out 2>&1"
  328. if egrep "memchr" conftest.out >/dev/null 2>&1; then
  329.   # SGI's /bin/cc from Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
  330. cat > conftest.c <<EOF
  331. #include <ctype.h>
  332. #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
  333. #define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
  334. #define XOR(e,f) (((e) && !(f)) || (!(e) && (f)))
  335. int main () { int i; for (i = 0; i < 256; i++)
  336. if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
  337. exit (0); }
  338.  
  339. EOF
  340. eval $compile
  341. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  342.   {
  343. test -n "$verbose" && \
  344. echo '    defining' STDC_HEADERS
  345. DEFS="$DEFS -DSTDC_HEADERS=1"
  346. SEDDEFS="${SEDDEFS}\${SEDdA}STDC_HEADERS\${SEDdB}STDC_HEADERS\${SEDdC}1\${SEDdD}
  347. \${SEDuA}STDC_HEADERS\${SEDuB}STDC_HEADERS\${SEDuC}1\${SEDuD}
  348. \${SEDeA}STDC_HEADERS\${SEDeB}STDC_HEADERS\${SEDeC}1\${SEDeD}
  349. "
  350. }
  351.  
  352. fi
  353. rm -f conftest*
  354. fi
  355. rm -f conftest*
  356.  
  357. fi
  358. rm -f conftest*
  359.  
  360. echo checking for unistd.h
  361. cat > conftest.c <<EOF
  362. #include <unistd.h>
  363. EOF
  364. err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
  365. if test -z "$err"; then
  366.   {
  367. test -n "$verbose" && \
  368. echo '    defining' HAVE_UNISTD_H
  369. DEFS="$DEFS -DHAVE_UNISTD_H=1"
  370. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_UNISTD_H\${SEDdB}HAVE_UNISTD_H\${SEDdC}1\${SEDdD}
  371. \${SEDuA}HAVE_UNISTD_H\${SEDuB}HAVE_UNISTD_H\${SEDuC}1\${SEDuD}
  372. \${SEDeA}HAVE_UNISTD_H\${SEDeB}HAVE_UNISTD_H\${SEDeC}1\${SEDeD}
  373. "
  374. }
  375.  
  376. fi
  377. rm -f conftest*
  378.  
  379. echo checking for directory library header
  380. dirheader=
  381. if test -z "$dirheader"; then
  382.   echo checking for dirent.h
  383. cat > conftest.c <<EOF
  384. #include <sys/types.h>
  385. #include <dirent.h>
  386. int main() { exit(0); }
  387. int t() { DIR *dirp = opendir ("/"); }
  388. EOF
  389. if eval $compile; then
  390.   {
  391. test -n "$verbose" && \
  392. echo '    defining' DIRENT
  393. DEFS="$DEFS -DDIRENT=1"
  394. SEDDEFS="${SEDDEFS}\${SEDdA}DIRENT\${SEDdB}DIRENT\${SEDdC}1\${SEDdD}
  395. \${SEDuA}DIRENT\${SEDuB}DIRENT\${SEDuC}1\${SEDuD}
  396. \${SEDeA}DIRENT\${SEDeB}DIRENT\${SEDeC}1\${SEDeD}
  397. "
  398. }
  399.  dirheader=dirent.h
  400. fi
  401. rm -f conftest*
  402. fi
  403. if test -z "$dirheader"; then
  404.   echo checking for sys/ndir.h
  405. cat > conftest.c <<EOF
  406. #include <sys/types.h>
  407. #include <sys/ndir.h>
  408. int main() { exit(0); }
  409. int t() { DIR *dirp = opendir ("/"); }
  410. EOF
  411. if eval $compile; then
  412.   {
  413. test -n "$verbose" && \
  414. echo '    defining' SYSNDIR
  415. DEFS="$DEFS -DSYSNDIR=1"
  416. SEDDEFS="${SEDDEFS}\${SEDdA}SYSNDIR\${SEDdB}SYSNDIR\${SEDdC}1\${SEDdD}
  417. \${SEDuA}SYSNDIR\${SEDuB}SYSNDIR\${SEDuC}1\${SEDuD}
  418. \${SEDeA}SYSNDIR\${SEDeB}SYSNDIR\${SEDeC}1\${SEDeD}
  419. "
  420. }
  421.  dirheader=sys/ndir.h
  422. fi
  423. rm -f conftest*
  424. fi
  425. if test -z "$dirheader"; then
  426.   echo checking for sys/dir.h
  427. cat > conftest.c <<EOF
  428. #include <sys/types.h>
  429. #include <sys/dir.h>
  430. int main() { exit(0); }
  431. int t() { DIR *dirp = opendir ("/"); }
  432. EOF
  433. if eval $compile; then
  434.   {
  435. test -n "$verbose" && \
  436. echo '    defining' SYSDIR
  437. DEFS="$DEFS -DSYSDIR=1"
  438. SEDDEFS="${SEDDEFS}\${SEDdA}SYSDIR\${SEDdB}SYSDIR\${SEDdC}1\${SEDdD}
  439. \${SEDuA}SYSDIR\${SEDuB}SYSDIR\${SEDuC}1\${SEDuD}
  440. \${SEDeA}SYSDIR\${SEDeB}SYSDIR\${SEDeC}1\${SEDeD}
  441. "
  442. }
  443.  dirheader=sys/dir.h
  444. fi
  445. rm -f conftest*
  446. fi
  447. if test -z "$dirheader"; then
  448.   echo checking for ndir.h
  449. cat > conftest.c <<EOF
  450. #include <sys/types.h>
  451. #include <ndir.h>
  452. int main() { exit(0); }
  453. int t() { DIR *dirp = opendir ("/"); }
  454. EOF
  455. if eval $compile; then
  456.   {
  457. test -n "$verbose" && \
  458. echo '    defining' NDIR
  459. DEFS="$DEFS -DNDIR=1"
  460. SEDDEFS="${SEDDEFS}\${SEDdA}NDIR\${SEDdB}NDIR\${SEDdC}1\${SEDdD}
  461. \${SEDuA}NDIR\${SEDuB}NDIR\${SEDuC}1\${SEDuD}
  462. \${SEDeA}NDIR\${SEDeB}NDIR\${SEDeC}1\${SEDeD}
  463. "
  464. }
  465.  dirheader=ndir.h
  466. fi
  467. rm -f conftest*
  468. fi
  469.  
  470. echo checking for closedir return value
  471. cat > conftest.c <<EOF
  472. #include <sys/types.h>
  473. #include <$dirheader>
  474. int closedir(); main() { exit(closedir(opendir(".")) != 0); }
  475. EOF
  476. eval $compile
  477. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  478.   :
  479. else
  480.   {
  481. test -n "$verbose" && \
  482. echo '    defining' VOID_CLOSEDIR
  483. DEFS="$DEFS -DVOID_CLOSEDIR=1"
  484. SEDDEFS="${SEDDEFS}\${SEDdA}VOID_CLOSEDIR\${SEDdB}VOID_CLOSEDIR\${SEDdC}1\${SEDdD}
  485. \${SEDuA}VOID_CLOSEDIR\${SEDuB}VOID_CLOSEDIR\${SEDuC}1\${SEDuD}
  486. \${SEDeA}VOID_CLOSEDIR\${SEDeB}VOID_CLOSEDIR\${SEDeC}1\${SEDeD}
  487. "
  488. }
  489.  
  490. fi
  491. rm -f conftest*
  492.  
  493. echo checking for uid_t in sys/types.h
  494. echo '#include <sys/types.h>' > conftest.c
  495. eval "$CPP \$DEFS conftest.c > conftest.out 2>&1"
  496. if egrep "uid_t" conftest.out >/dev/null 2>&1; then
  497.   :
  498. else
  499.   {
  500. test -n "$verbose" && \
  501. echo '    defining' uid_t to be 'int'
  502. DEFS="$DEFS -Duid_t=int"
  503. SEDDEFS="${SEDDEFS}\${SEDdA}uid_t\${SEDdB}uid_t\${SEDdC}int\${SEDdD}
  504. \${SEDuA}uid_t\${SEDuB}uid_t\${SEDuC}int\${SEDuD}
  505. \${SEDeA}uid_t\${SEDeB}uid_t\${SEDeC}int\${SEDeD}
  506. "
  507. }
  508.  {
  509. test -n "$verbose" && \
  510. echo '    defining' gid_t to be 'int'
  511. DEFS="$DEFS -Dgid_t=int"
  512. SEDDEFS="${SEDDEFS}\${SEDdA}gid_t\${SEDdB}gid_t\${SEDdC}int\${SEDdD}
  513. \${SEDuA}gid_t\${SEDuB}gid_t\${SEDuC}int\${SEDuD}
  514. \${SEDeA}gid_t\${SEDeB}gid_t\${SEDeC}int\${SEDeD}
  515. "
  516. }
  517.  
  518. fi
  519. rm -f conftest*
  520.             echo checking for type of array argument to getgroups
  521. prog='/* Thanks to Mike Rendell for this test.  */
  522. #include <sys/types.h>
  523. #define NGID 256
  524. #undef MAX
  525. #define MAX(x,y) ((x) > (y) ? (x) : (y))
  526. main()
  527. {
  528.   gid_t gidset[NGID];
  529.   int i, n;
  530.   union { gid_t gval; long lval; }  val;
  531.  
  532.   val.lval = -1;
  533.   for (i = 0; i < NGID; i++)
  534.     gidset[i] = val.gval;
  535.   n = getgroups (sizeof (gidset) / MAX (sizeof (int), sizeof (gid_t)) - 1,
  536.                  gidset);
  537.   /* Exit non-zero if getgroups seems to require an array of ints.  This
  538.      happens when gid_t is short but getgroups modifies an array of ints.  */
  539.   exit ((n > 0 && gidset[n] != val.gval) ? 1 : 0);
  540. }'
  541. cat > conftest.c <<EOF
  542. $prog
  543. EOF
  544. eval $compile
  545. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  546.   {
  547. test -n "$verbose" && \
  548. echo '    defining' GETGROUPS_T to be 'gid_t'
  549. DEFS="$DEFS -DGETGROUPS_T=gid_t"
  550. SEDDEFS="${SEDDEFS}\${SEDdA}GETGROUPS_T\${SEDdB}GETGROUPS_T\${SEDdC}gid_t\${SEDdD}
  551. \${SEDuA}GETGROUPS_T\${SEDuB}GETGROUPS_T\${SEDuC}gid_t\${SEDuD}
  552. \${SEDeA}GETGROUPS_T\${SEDeB}GETGROUPS_T\${SEDeC}gid_t\${SEDeD}
  553. "
  554. }
  555.  
  556. else
  557.   {
  558. test -n "$verbose" && \
  559. echo '    defining' GETGROUPS_T to be 'int'
  560. DEFS="$DEFS -DGETGROUPS_T=int"
  561. SEDDEFS="${SEDDEFS}\${SEDdA}GETGROUPS_T\${SEDdB}GETGROUPS_T\${SEDdC}int\${SEDdD}
  562. \${SEDuA}GETGROUPS_T\${SEDuB}GETGROUPS_T\${SEDuC}int\${SEDuD}
  563. \${SEDeA}GETGROUPS_T\${SEDeB}GETGROUPS_T\${SEDeC}int\${SEDeD}
  564. "
  565. }
  566.  
  567. fi
  568. rm -f conftest*
  569.  
  570. echo checking for pid_t in sys/types.h
  571. echo '#include <sys/types.h>' > conftest.c
  572. eval "$CPP \$DEFS conftest.c > conftest.out 2>&1"
  573. if egrep "pid_t" conftest.out >/dev/null 2>&1; then
  574.   :
  575. else
  576.   {
  577. test -n "$verbose" && \
  578. echo '    defining' pid_t to be 'int'
  579. DEFS="$DEFS -Dpid_t=int"
  580. SEDDEFS="${SEDDEFS}\${SEDdA}pid_t\${SEDdB}pid_t\${SEDdC}int\${SEDdD}
  581. \${SEDuA}pid_t\${SEDuB}pid_t\${SEDuC}int\${SEDuD}
  582. \${SEDeA}pid_t\${SEDeB}pid_t\${SEDeC}int\${SEDeD}
  583. "
  584. }
  585.  
  586. fi
  587. rm -f conftest*
  588.  
  589. echo checking for return type of signal handlers
  590. cat > conftest.c <<EOF
  591. #include <sys/types.h>
  592. #include <signal.h>
  593. #ifdef signal
  594. #undef signal
  595. #endif
  596. extern void (*signal ()) ();
  597. int main() { exit(0); }
  598. int t() { int i; }
  599. EOF
  600. if eval $compile; then
  601.   {
  602. test -n "$verbose" && \
  603. echo '    defining' RETSIGTYPE to be 'void'
  604. DEFS="$DEFS -DRETSIGTYPE=void"
  605. SEDDEFS="${SEDDEFS}\${SEDdA}RETSIGTYPE\${SEDdB}RETSIGTYPE\${SEDdC}void\${SEDdD}
  606. \${SEDuA}RETSIGTYPE\${SEDuB}RETSIGTYPE\${SEDuC}void\${SEDuD}
  607. \${SEDeA}RETSIGTYPE\${SEDeB}RETSIGTYPE\${SEDeC}void\${SEDeD}
  608. "
  609. }
  610.  
  611. else
  612.   {
  613. test -n "$verbose" && \
  614. echo '    defining' RETSIGTYPE to be 'int'
  615. DEFS="$DEFS -DRETSIGTYPE=int"
  616. SEDDEFS="${SEDDEFS}\${SEDdA}RETSIGTYPE\${SEDdB}RETSIGTYPE\${SEDdC}int\${SEDdD}
  617. \${SEDuA}RETSIGTYPE\${SEDuB}RETSIGTYPE\${SEDuC}int\${SEDuD}
  618. \${SEDeA}RETSIGTYPE\${SEDeB}RETSIGTYPE\${SEDeC}int\${SEDeD}
  619. "
  620. }
  621.  
  622. fi
  623. rm -f conftest*
  624.  
  625.  
  626. for hdr in limits.h sys/param.h fcntl.h string.h memory.h
  627. do
  628. trhdr=HAVE_`echo $hdr | tr '[a-z]./' '[A-Z]__'`
  629. echo checking for ${hdr}
  630. cat > conftest.c <<EOF
  631. #include <${hdr}>
  632. EOF
  633. err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
  634. if test -z "$err"; then
  635.   {
  636. test -n "$verbose" && \
  637. echo '    defining' ${trhdr}
  638. DEFS="$DEFS -D${trhdr}=1"
  639. SEDDEFS="${SEDDEFS}\${SEDdA}${trhdr}\${SEDdB}${trhdr}\${SEDdC}1\${SEDdD}
  640. \${SEDuA}${trhdr}\${SEDuB}${trhdr}\${SEDuC}1\${SEDuD}
  641. \${SEDeA}${trhdr}\${SEDeB}${trhdr}\${SEDeC}1\${SEDeD}
  642. "
  643. }
  644.  
  645. fi
  646. rm -f conftest*
  647. done
  648.  
  649. echo checking whether $CC and cc understand -c and -o together
  650. echo 'foo(){}' > conftest.c
  651. # Make sure it works both with $CC and with simple cc.
  652. # We do the test twice because some compilers refuse to overwrite an
  653. # existing .o file with -o, though they will create one.
  654. if ${CC-cc} -c conftest.c -o conftest.o >/dev/null 2>&1 && \
  655. test -f conftest.o && ${CC-cc} -c conftest.c -o conftest.o >/dev/null 2>&1 && \
  656. cc -c conftest.c -o conftest2.o >/dev/null 2>&1 && \
  657. test -f conftest2.o && cc -c conftest.c -o conftest2.o >/dev/null 2>&1
  658. then
  659.   :
  660. else
  661.   {
  662. test -n "$verbose" && \
  663. echo '    defining' NO_MINUS_C_MINUS_O
  664. DEFS="$DEFS -DNO_MINUS_C_MINUS_O=1"
  665. SEDDEFS="${SEDDEFS}\${SEDdA}NO_MINUS_C_MINUS_O\${SEDdB}NO_MINUS_C_MINUS_O\${SEDdC}1\${SEDdD}
  666. \${SEDuA}NO_MINUS_C_MINUS_O\${SEDuB}NO_MINUS_C_MINUS_O\${SEDuC}1\${SEDuD}
  667. \${SEDeA}NO_MINUS_C_MINUS_O\${SEDeB}NO_MINUS_C_MINUS_O\${SEDeC}1\${SEDeD}
  668. "
  669. }
  670.  
  671. fi
  672. rm -f conftest*
  673.  
  674. prog='/* Ultrix mips cc rejects this.  */
  675. typedef int charset[2]; const charset x;
  676. /* SunOS 4.1.1 cc rejects this.  */
  677. char const *const *ccp;
  678. char **p;
  679. /* AIX XL C 1.02.0.0 rejects this.
  680.    It does not let you subtract one const X* pointer from another in an arm
  681.    of an if-expression whose if-part is not a constant expression */
  682. const char *g = "string";
  683. p = &g + (g ? g-g : 0);
  684. /* HPUX 7.0 cc rejects these. */
  685. ++ccp;
  686. p = (char**) ccp;
  687. ccp = (char const *const *) p;
  688. { /* SCO 3.2v4 cc rejects this.  */
  689.   char *t;
  690.   char const *s = 0 ? (char *) 0 : (char const *) 0;
  691.  
  692.   *t++ = 0;
  693. }
  694. { /* Someone thinks the Sun supposedly-ANSI compiler will reject this.  */
  695.   int x[] = {25,17};
  696.   const int *foo = &x[0];
  697.   ++foo;
  698. }
  699. { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
  700.   typedef const int *iptr;
  701.   iptr p = 0;
  702.   ++p;
  703. }
  704. { /* AIX XL C 1.02.0.0 rejects this saying
  705.      "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
  706.   struct s { int j; const int *ap[3]; };
  707.   struct s *b; b->j = 5;
  708. }'
  709. echo checking for working const
  710. cat > conftest.c <<EOF
  711.  
  712. int main() { exit(0); }
  713. int t() { $prog }
  714. EOF
  715. if eval $compile; then
  716.   :
  717. else
  718.   {
  719. test -n "$verbose" && \
  720. echo '    defining' const to be 'empty'
  721. DEFS="$DEFS -Dconst="
  722. SEDDEFS="${SEDDEFS}\${SEDdA}const\${SEDdB}const\${SEDdC}\${SEDdD}
  723. \${SEDuA}const\${SEDuB}const\${SEDuC}\${SEDuD}
  724. \${SEDeA}const\${SEDeB}const\${SEDeC}\${SEDeD}
  725. "
  726. }
  727.  
  728. fi
  729. rm -f conftest*
  730.             echo checking for BSD string and memory functions
  731. cat > conftest.c <<EOF
  732. #include <strings.h>
  733. int main() { exit(0); }
  734. int t() { rindex(0, 0); bzero(0, 0); }
  735. EOF
  736. if eval $compile; then
  737.   :
  738. else
  739.   {
  740. test -n "$verbose" && \
  741. echo '    defining' USG
  742. DEFS="$DEFS -DUSG=1"
  743. SEDDEFS="${SEDDEFS}\${SEDdA}USG\${SEDdB}USG\${SEDdC}1\${SEDdD}
  744. \${SEDuA}USG\${SEDuB}USG\${SEDuC}1\${SEDuD}
  745. \${SEDeA}USG\${SEDeB}USG\${SEDeC}1\${SEDeD}
  746. "
  747. }
  748.  
  749. fi
  750. rm -f conftest*
  751.  
  752.  
  753.  
  754.  
  755. for func in getdtablesize sys_siglist _sys_siglist psignal \
  756.           dup2 getcwd sigsetmask getgroups setlinebuf \
  757.           setreuid setregid
  758. do
  759. trfunc=HAVE_`echo $func | tr '[a-z]' '[A-Z]'`
  760. echo checking for ${func}
  761. cat > conftest.c <<EOF
  762. #include <ctype.h>
  763. int main() { exit(0); }
  764. int t() { 
  765. /* The GNU C library defines this for functions which it implements
  766.     to always fail with ENOSYS.  Some functions are actually named
  767.     something starting with __ and the normal name is an alias.  */
  768. #if defined (__stub_${func}) || defined (__stub___${func})
  769. choke me
  770. #else
  771. /* Override any gcc2 internal prototype to avoid an error.  */
  772. extern char ${func}(); ${func}();
  773. #endif
  774.  }
  775. EOF
  776. if eval $compile; then
  777.   {
  778. test -n "$verbose" && \
  779. echo '    defining' ${trfunc}
  780. DEFS="$DEFS -D${trfunc}=1"
  781. SEDDEFS="${SEDDEFS}\${SEDdA}${trfunc}\${SEDdB}${trfunc}\${SEDdC}1\${SEDdD}
  782. \${SEDuA}${trfunc}\${SEDuB}${trfunc}\${SEDuC}1\${SEDuD}
  783. \${SEDeA}${trfunc}\${SEDeB}${trfunc}\${SEDeC}1\${SEDeD}
  784. "
  785. }
  786.  
  787. fi
  788. rm -f conftest*
  789. done
  790.  
  791. # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
  792. # for constant arguments.  Useless!
  793. echo checking for working alloca.h
  794. cat > conftest.c <<EOF
  795. #include <alloca.h>
  796. int main() { exit(0); }
  797. int t() { char *p = alloca(2 * sizeof(int)); }
  798. EOF
  799. if eval $compile; then
  800.   {
  801. test -n "$verbose" && \
  802. echo '    defining' HAVE_ALLOCA_H
  803. DEFS="$DEFS -DHAVE_ALLOCA_H=1"
  804. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_ALLOCA_H\${SEDdB}HAVE_ALLOCA_H\${SEDdC}1\${SEDdD}
  805. \${SEDuA}HAVE_ALLOCA_H\${SEDuB}HAVE_ALLOCA_H\${SEDuC}1\${SEDuD}
  806. \${SEDeA}HAVE_ALLOCA_H\${SEDeB}HAVE_ALLOCA_H\${SEDeC}1\${SEDeD}
  807. "
  808. }
  809.  
  810. fi
  811. rm -f conftest*
  812.  
  813. decl="#ifdef __GNUC__
  814. #define alloca __builtin_alloca
  815. #else
  816. #if HAVE_ALLOCA_H
  817. #include <alloca.h>
  818. #else
  819. #ifdef _AIX
  820.  #pragma alloca
  821. #else
  822. char *alloca ();
  823. #endif
  824. #endif
  825. #endif
  826. "
  827. echo checking for alloca
  828. cat > conftest.c <<EOF
  829. $decl
  830. int main() { exit(0); }
  831. int t() { char *p = (char *) alloca(1); }
  832. EOF
  833. if eval $compile; then
  834.   :
  835. else
  836.   alloca_missing=1
  837. cat > conftest.c <<EOF
  838.  
  839. #if defined(CRAY) && ! defined(CRAY2)
  840. winnitude
  841. #else
  842. lossage
  843. #endif
  844.  
  845. EOF
  846. eval "$CPP \$DEFS conftest.c > conftest.out 2>&1"
  847. if egrep "winnitude" conftest.out >/dev/null 2>&1; then
  848.   echo checking for _getb67
  849. cat > conftest.c <<EOF
  850. #include <ctype.h>
  851. int main() { exit(0); }
  852. int t() { 
  853. /* The GNU C library defines this for functions which it implements
  854.     to always fail with ENOSYS.  Some functions are actually named
  855.     something starting with __ and the normal name is an alias.  */
  856. #if defined (__stub__getb67) || defined (__stub____getb67)
  857. choke me
  858. #else
  859. /* Override any gcc2 internal prototype to avoid an error.  */
  860. extern char _getb67(); _getb67();
  861. #endif
  862.  }
  863. EOF
  864. if eval $compile; then
  865.   {
  866. test -n "$verbose" && \
  867. echo '    defining' CRAY_STACKSEG_END to be '_getb67'
  868. DEFS="$DEFS -DCRAY_STACKSEG_END=_getb67"
  869. SEDDEFS="${SEDDEFS}\${SEDdA}CRAY_STACKSEG_END\${SEDdB}CRAY_STACKSEG_END\${SEDdC}_getb67\${SEDdD}
  870. \${SEDuA}CRAY_STACKSEG_END\${SEDuB}CRAY_STACKSEG_END\${SEDuC}_getb67\${SEDuD}
  871. \${SEDeA}CRAY_STACKSEG_END\${SEDeB}CRAY_STACKSEG_END\${SEDeC}_getb67\${SEDeD}
  872. "
  873. }
  874.  
  875. else
  876.   echo checking for GETB67
  877. cat > conftest.c <<EOF
  878. #include <ctype.h>
  879. int main() { exit(0); }
  880. int t() { 
  881. /* The GNU C library defines this for functions which it implements
  882.     to always fail with ENOSYS.  Some functions are actually named
  883.     something starting with __ and the normal name is an alias.  */
  884. #if defined (__stub_GETB67) || defined (__stub___GETB67)
  885. choke me
  886. #else
  887. /* Override any gcc2 internal prototype to avoid an error.  */
  888. extern char GETB67(); GETB67();
  889. #endif
  890.  }
  891. EOF
  892. if eval $compile; then
  893.   {
  894. test -n "$verbose" && \
  895. echo '    defining' CRAY_STACKSEG_END to be 'GETB67'
  896. DEFS="$DEFS -DCRAY_STACKSEG_END=GETB67"
  897. SEDDEFS="${SEDDEFS}\${SEDdA}CRAY_STACKSEG_END\${SEDdB}CRAY_STACKSEG_END\${SEDdC}GETB67\${SEDdD}
  898. \${SEDuA}CRAY_STACKSEG_END\${SEDuB}CRAY_STACKSEG_END\${SEDuC}GETB67\${SEDuD}
  899. \${SEDeA}CRAY_STACKSEG_END\${SEDeB}CRAY_STACKSEG_END\${SEDeC}GETB67\${SEDeD}
  900. "
  901. }
  902.  
  903. else
  904.   echo checking for getb67
  905. cat > conftest.c <<EOF
  906. #include <ctype.h>
  907. int main() { exit(0); }
  908. int t() { 
  909. /* The GNU C library defines this for functions which it implements
  910.     to always fail with ENOSYS.  Some functions are actually named
  911.     something starting with __ and the normal name is an alias.  */
  912. #if defined (__stub_getb67) || defined (__stub___getb67)
  913. choke me
  914. #else
  915. /* Override any gcc2 internal prototype to avoid an error.  */
  916. extern char getb67(); getb67();
  917. #endif
  918.  }
  919. EOF
  920. if eval $compile; then
  921.   {
  922. test -n "$verbose" && \
  923. echo '    defining' CRAY_STACKSEG_END to be 'getb67'
  924. DEFS="$DEFS -DCRAY_STACKSEG_END=getb67"
  925. SEDDEFS="${SEDDEFS}\${SEDdA}CRAY_STACKSEG_END\${SEDdB}CRAY_STACKSEG_END\${SEDdC}getb67\${SEDdD}
  926. \${SEDuA}CRAY_STACKSEG_END\${SEDuB}CRAY_STACKSEG_END\${SEDuC}getb67\${SEDuD}
  927. \${SEDeA}CRAY_STACKSEG_END\${SEDeB}CRAY_STACKSEG_END\${SEDeC}getb67\${SEDeD}
  928. "
  929. }
  930.  
  931. fi
  932. rm -f conftest*
  933.  
  934. fi
  935. rm -f conftest*
  936.  
  937. fi
  938. rm -f conftest*
  939.  
  940. fi
  941. rm -f conftest*
  942.  
  943.  
  944. fi
  945. rm -f conftest*
  946.  
  947. if test -n "$alloca_missing"; then
  948.   # The SVR3 libPW and SVR4 libucb both contain incompatible functions
  949.   # that cause trouble.  Some versions do not even contain alloca or
  950.   # contain a buggy version.  If you still want to use their alloca,
  951.   # use ar to extract alloca.o from them instead of compiling alloca.c.
  952.   ALLOCA=alloca.o
  953.  
  954.   echo 'checking stack direction for C alloca'
  955.   echo checking whether cross-compiling
  956. # If we cannot run a trivial program, we must be cross compiling.
  957. cat > conftest.c <<EOF
  958. main(){exit(0);}
  959. EOF
  960. eval $compile
  961. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  962.   :
  963. else
  964.   cross_compiling=1
  965. fi
  966. rm -f conftest*
  967.  
  968. if test -n "$cross_compiling"
  969. then
  970.   {
  971. test -n "$verbose" && \
  972. echo '    defining' STACK_DIRECTION to be '0'
  973. DEFS="$DEFS -DSTACK_DIRECTION=0"
  974. SEDDEFS="${SEDDEFS}\${SEDdA}STACK_DIRECTION\${SEDdB}STACK_DIRECTION\${SEDdC}0\${SEDdD}
  975. \${SEDuA}STACK_DIRECTION\${SEDuB}STACK_DIRECTION\${SEDuC}0\${SEDuD}
  976. \${SEDeA}STACK_DIRECTION\${SEDeB}STACK_DIRECTION\${SEDeC}0\${SEDeD}
  977. "
  978. }
  979.  
  980. else
  981. cat > conftest.c <<EOF
  982. find_stack_direction ()
  983. {
  984.   static char *addr = 0;
  985.   auto char dummy;
  986.   if (addr == 0)
  987.     {
  988.       addr = &dummy;
  989.       return find_stack_direction ();
  990.     }
  991.   else
  992.     return (&dummy > addr) ? 1 : -1;
  993. }
  994. main ()
  995. {
  996.   exit (find_stack_direction() < 0);
  997. }
  998. EOF
  999. eval $compile
  1000. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  1001.   {
  1002. test -n "$verbose" && \
  1003. echo '    defining' STACK_DIRECTION to be '1'
  1004. DEFS="$DEFS -DSTACK_DIRECTION=1"
  1005. SEDDEFS="${SEDDEFS}\${SEDdA}STACK_DIRECTION\${SEDdB}STACK_DIRECTION\${SEDdC}1\${SEDdD}
  1006. \${SEDuA}STACK_DIRECTION\${SEDuB}STACK_DIRECTION\${SEDuC}1\${SEDuD}
  1007. \${SEDeA}STACK_DIRECTION\${SEDeB}STACK_DIRECTION\${SEDeC}1\${SEDeD}
  1008. "
  1009. }
  1010.  
  1011. else
  1012.   {
  1013. test -n "$verbose" && \
  1014. echo '    defining' STACK_DIRECTION to be '-1'
  1015. DEFS="$DEFS -DSTACK_DIRECTION=-1"
  1016. SEDDEFS="${SEDDEFS}\${SEDdA}STACK_DIRECTION\${SEDdB}STACK_DIRECTION\${SEDdC}-1\${SEDdD}
  1017. \${SEDuA}STACK_DIRECTION\${SEDuB}STACK_DIRECTION\${SEDuC}-1\${SEDuD}
  1018. \${SEDeA}STACK_DIRECTION\${SEDeB}STACK_DIRECTION\${SEDeC}-1\${SEDeD}
  1019. "
  1020. }
  1021.  
  1022. fi
  1023. fi
  1024. rm -f conftest*
  1025. fi
  1026.  
  1027. echo checking for vfork.h
  1028. cat > conftest.c <<EOF
  1029. #include <vfork.h>
  1030. EOF
  1031. err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
  1032. if test -z "$err"; then
  1033.   {
  1034. test -n "$verbose" && \
  1035. echo '    defining' HAVE_VFORK_H
  1036. DEFS="$DEFS -DHAVE_VFORK_H=1"
  1037. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_VFORK_H\${SEDdB}HAVE_VFORK_H\${SEDdC}1\${SEDdD}
  1038. \${SEDuA}HAVE_VFORK_H\${SEDuB}HAVE_VFORK_H\${SEDuC}1\${SEDuD}
  1039. \${SEDeA}HAVE_VFORK_H\${SEDeB}HAVE_VFORK_H\${SEDeC}1\${SEDeD}
  1040. "
  1041. }
  1042.  
  1043. fi
  1044. rm -f conftest*
  1045.  
  1046. echo checking for working vfork
  1047. cat > conftest.c <<EOF
  1048. /* Thanks to Paul Eggert for this test.  */
  1049. #include <stdio.h>
  1050. #include <sys/types.h>
  1051. #include <sys/stat.h>
  1052. #ifdef HAVE_UNISTD_H
  1053. #include <unistd.h>
  1054. #endif
  1055. #ifdef HAVE_VFORK_H
  1056. #include <vfork.h>
  1057. #endif
  1058. main() {
  1059.   pid_t parent = getpid();
  1060.   pid_t child = vfork();
  1061.  
  1062.   if (child == 0) {
  1063.     /* On sparc systems, changes by the child to local and incoming
  1064.        argument registers are propagated back to the parent.
  1065.        The compiler is told about this with #include <vfork.h>,
  1066.        but some compilers (e.g. gcc -O) don't grok <vfork.h>.
  1067.        Test for this by using lots of local variables, at least
  1068.        as many local variables as main has allocated so far
  1069.        including compiler temporaries.  4 locals are enough for
  1070.        gcc 1.40.3 on a sparc, but we use 8 to be safe.
  1071.        A buggy compiler should reuse the register of parent
  1072.        for one of the local variables, since it will think that
  1073.        parent can't possibly be used any more in this routine.
  1074.        Assigning to the local variable will thus munge parent
  1075.        in the parent process.  */
  1076.     pid_t
  1077.       p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(),
  1078.       p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid();
  1079.     /* Convince the compiler that p..p7 are live; otherwise, it might
  1080.        use the same hardware register for all 8 local variables.  */
  1081.     if (p != p1 || p != p2 || p != p3 || p != p4
  1082.     || p != p5 || p != p6 || p != p7)
  1083.       _exit(1);
  1084.  
  1085.     /* On some systems (e.g. IRIX 3.3),
  1086.        vfork doesn't separate parent from child file descriptors.
  1087.        If the child closes a descriptor before it execs or exits,
  1088.        this munges the parent's descriptor as well.
  1089.        Test for this by closing stdout in the child.  */
  1090.     _exit(close(fileno(stdout)) != 0);
  1091.   } else {
  1092.     int status;
  1093.     struct stat st;
  1094.  
  1095.     while (wait(&status) != child)
  1096.       ;
  1097.     exit(
  1098.      /* Was there some problem with vforking?  */
  1099.      child < 0
  1100.  
  1101.      /* Did the child fail?  (This shouldn't happen.)  */
  1102.      || status
  1103.  
  1104.      /* Did the vfork/compiler bug occur?  */
  1105.      || parent != getpid()
  1106.  
  1107.      /* Did the file descriptor bug occur?  */
  1108.      || fstat(fileno(stdout), &st) != 0
  1109.      );
  1110.   }
  1111. }
  1112. EOF
  1113. eval $compile
  1114. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  1115.   :
  1116. else
  1117.   {
  1118. test -n "$verbose" && \
  1119. echo '    defining' vfork to be 'fork'
  1120. DEFS="$DEFS -Dvfork=fork"
  1121. SEDDEFS="${SEDDEFS}\${SEDdA}vfork\${SEDdB}vfork\${SEDdC}fork\${SEDdD}
  1122. \${SEDuA}vfork\${SEDuB}vfork\${SEDuC}fork\${SEDuD}
  1123. \${SEDeA}vfork\${SEDeB}vfork\${SEDeC}fork\${SEDeD}
  1124. "
  1125. }
  1126.  
  1127. fi
  1128. rm -f conftest*
  1129.  
  1130. cat > conftest.c <<EOF
  1131. #include <stdio.h>
  1132. main () {
  1133.   /* If setvbuf has the reversed format, exit 0. */
  1134.   if (setvbuf(stdout, _IOLBF, (char *) 0, BUFSIZ) != 0)/* The reversed way.  */
  1135.     exit(1);
  1136.   putc('\r', stdout);
  1137.   exit(0);            /* Non-reversed systems segv here.  */
  1138. }
  1139. EOF
  1140. eval $compile
  1141. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  1142.   {
  1143. test -n "$verbose" && \
  1144. echo '    defining' SETVBUF_REVERSED
  1145. DEFS="$DEFS -DSETVBUF_REVERSED=1"
  1146. SEDDEFS="${SEDDEFS}\${SEDdA}SETVBUF_REVERSED\${SEDdB}SETVBUF_REVERSED\${SEDdC}1\${SEDdD}
  1147. \${SEDuA}SETVBUF_REVERSED\${SEDuB}SETVBUF_REVERSED\${SEDuC}1\${SEDuD}
  1148. \${SEDeA}SETVBUF_REVERSED\${SEDeB}SETVBUF_REVERSED\${SEDeC}1\${SEDeD}
  1149. "
  1150. }
  1151.  
  1152. fi
  1153. rm -f conftest*
  1154. rm -f core
  1155.  
  1156. # Some definitions of getloadavg require that the program be installed setgid.
  1157. NEED_SETGID=false
  1158.  
  1159. # Check for the 4.4BSD definition of getloadavg.
  1160. LIBS_save="${LIBS}"
  1161. LIBS="${LIBS} -lutils"
  1162. have_lib=""
  1163. echo checking for -lutils
  1164. cat > conftest.c <<EOF
  1165.  
  1166. int main() { exit(0); }
  1167. int t() { main(); }
  1168. EOF
  1169. if eval $compile; then
  1170.   have_lib="1"
  1171. fi
  1172. rm -f conftest*
  1173. LIBS="${LIBS_save}"
  1174. if test -n "${have_lib}"; then
  1175.    :; LIBS="$LIBS -lutils"
  1176. else
  1177.    :; 
  1178. fi
  1179.  
  1180.  
  1181. # There is a commonly available library for RS/6000 AIX.  Is it installed?
  1182. LIBS_save="${LIBS}"
  1183. LIBS="${LIBS} -lgetloadavg"
  1184. have_lib=""
  1185. echo checking for -lgetloadavg
  1186. cat > conftest.c <<EOF
  1187.  
  1188. int main() { exit(0); }
  1189. int t() { main(); }
  1190. EOF
  1191. if eval $compile; then
  1192.   have_lib="1"
  1193. fi
  1194. rm -f conftest*
  1195. LIBS="${LIBS_save}"
  1196. if test -n "${have_lib}"; then
  1197.    :; LIBS="$LIBS -lgetloadavg"
  1198. else
  1199.    :; # Since it is not a standard part of AIX, it might be installed locally.
  1200. LIBS_save="$LIBS"
  1201. LIBS="$LIBS /usr/local/lib/libgetloadavg.a"
  1202. echo checking for local getloadavg library
  1203. cat > conftest.c <<EOF
  1204.  
  1205. int main() { exit(0); }
  1206. int t() { double load; int nelem = getloadavg (&load, 1); }
  1207. EOF
  1208. if eval $compile; then
  1209.   getloadavg_missing=false
  1210. else
  1211.   getloadavg_missing=true
  1212. fi
  1213. rm -f conftest*
  1214. if $getloadavg_missing; then
  1215.   # It wasn't there.  Restore the old value of LIBS.
  1216.   LIBS="$LIBS_save"
  1217. else
  1218.   # It was there.  If it is a shared library, we will need a -L switch to
  1219.   # tell the program where to find it at run-time; just giving the full
  1220.   # file name is not enough.
  1221.   LDFLAGS="$LDFLAGS -L/usr/local/lib"
  1222. fi
  1223. fi
  1224.  
  1225. for func in getloadavg
  1226. do
  1227. echo checking for ${func}
  1228. cat > conftest.c <<EOF
  1229.  
  1230. int main() { exit(0); }
  1231. int t() { /* The GNU C library defines this for functions which it implements
  1232.     to always fail with ENOSYS.  Some functions are actually named
  1233.     something starting with __ and the normal name is an alias.  */
  1234. #if defined (__stub_${func}) || defined (__stub___${func})
  1235. choke me
  1236. #else
  1237. /* Override any gcc2 internal prototype to avoid an error.  */
  1238. extern char ${func}(); ${func}();
  1239. #endif
  1240.  }
  1241. EOF
  1242. if eval $compile; then
  1243.   :
  1244. else
  1245.   LIBOBJS="$LIBOBJS ${func}.o"
  1246. test -n "$verbose" && echo "    using ${func}.o instead"
  1247. fi
  1248. rm -f conftest*
  1249.  
  1250. done
  1251.  
  1252.  
  1253. case "$LIBOBJS" in
  1254. *getloadavg*)
  1255. echo checking for sys/dg_sys_info.h
  1256. cat > conftest.c <<EOF
  1257. #include <sys/dg_sys_info.h>
  1258. EOF
  1259. err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
  1260. if test -z "$err"; then
  1261.   {
  1262. test -n "$verbose" && \
  1263. echo '    defining' DGUX
  1264. DEFS="$DEFS -DDGUX=1"
  1265. SEDDEFS="${SEDDEFS}\${SEDdA}DGUX\${SEDdB}DGUX\${SEDdC}1\${SEDdD}
  1266. \${SEDuA}DGUX\${SEDuB}DGUX\${SEDuC}1\${SEDuD}
  1267. \${SEDeA}DGUX\${SEDeB}DGUX\${SEDeC}1\${SEDeD}
  1268. "
  1269. }
  1270.  have_sym=1
  1271. fi
  1272. rm -f conftest*
  1273.  
  1274. if test -z "$have_sym"; then
  1275. echo checking for dwarf.h
  1276. cat > conftest.c <<EOF
  1277. #include <dwarf.h>
  1278. EOF
  1279. err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
  1280. if test -z "$err"; then
  1281.   {
  1282. test -n "$verbose" && \
  1283. echo '    defining' SVR4
  1284. DEFS="$DEFS -DSVR4=1"
  1285. SEDDEFS="${SEDDEFS}\${SEDdA}SVR4\${SEDdB}SVR4\${SEDdC}1\${SEDdD}
  1286. \${SEDuA}SVR4\${SEDuB}SVR4\${SEDuC}1\${SEDuD}
  1287. \${SEDeA}SVR4\${SEDeB}SVR4\${SEDeC}1\${SEDeD}
  1288. "
  1289. }
  1290.  LIBS="$LIBS -lelf" have_sym=1
  1291. fi
  1292. rm -f conftest*
  1293.  
  1294. fi
  1295. if test -z "$have_sym"; then
  1296. # Solaris 2 does not use dwarf, but it's still SVR4.
  1297. echo checking for elf.h
  1298. cat > conftest.c <<EOF
  1299. #include <elf.h>
  1300. EOF
  1301. err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
  1302. if test -z "$err"; then
  1303.   {
  1304. test -n "$verbose" && \
  1305. echo '    defining' SVR4
  1306. DEFS="$DEFS -DSVR4=1"
  1307. SEDDEFS="${SEDDEFS}\${SEDdA}SVR4\${SEDdB}SVR4\${SEDdC}1\${SEDdD}
  1308. \${SEDuA}SVR4\${SEDuB}SVR4\${SEDuC}1\${SEDuD}
  1309. \${SEDeA}SVR4\${SEDeB}SVR4\${SEDeC}1\${SEDeD}
  1310. "
  1311. }
  1312.  LIBS="$LIBS -lelf" have_sym=1
  1313.   LIBS_save="${LIBS}"
  1314. LIBS="${LIBS} -lkvm"
  1315. have_lib=""
  1316. echo checking for -lkvm
  1317. cat > conftest.c <<EOF
  1318.  
  1319. int main() { exit(0); }
  1320. int t() { main(); }
  1321. EOF
  1322. if eval $compile; then
  1323.   have_lib="1"
  1324. fi
  1325. rm -f conftest*
  1326. LIBS="${LIBS_save}"
  1327. if test -n "${have_lib}"; then
  1328.    :; LIBS="$LIBS -lkvm"
  1329. else
  1330.    :; 
  1331. fi
  1332.  
  1333. fi
  1334. rm -f conftest*
  1335.  
  1336. fi
  1337. if test -z "$have_sym"; then
  1338. echo checking for inq_stats/cpustats.h
  1339. cat > conftest.c <<EOF
  1340. #include <inq_stats/cpustats.h>
  1341. EOF
  1342. err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
  1343. if test -z "$err"; then
  1344.   {
  1345. test -n "$verbose" && \
  1346. echo '    defining' UMAX4_3
  1347. DEFS="$DEFS -DUMAX4_3=1"
  1348. SEDDEFS="${SEDDEFS}\${SEDdA}UMAX4_3\${SEDdB}UMAX4_3\${SEDdC}1\${SEDdD}
  1349. \${SEDuA}UMAX4_3\${SEDuB}UMAX4_3\${SEDuC}1\${SEDuD}
  1350. \${SEDeA}UMAX4_3\${SEDeB}UMAX4_3\${SEDeC}1\${SEDeD}
  1351. "
  1352. }
  1353.  {
  1354. test -n "$verbose" && \
  1355. echo '    defining' UMAX
  1356. DEFS="$DEFS -DUMAX=1"
  1357. SEDDEFS="${SEDDEFS}\${SEDdA}UMAX\${SEDdB}UMAX\${SEDdC}1\${SEDdD}
  1358. \${SEDuA}UMAX\${SEDuB}UMAX\${SEDuC}1\${SEDuD}
  1359. \${SEDeA}UMAX\${SEDeB}UMAX\${SEDeC}1\${SEDeD}
  1360. "
  1361. }
  1362.  have_sym=1
  1363. fi
  1364. rm -f conftest*
  1365.  
  1366. fi
  1367. if test -z "$have_sym"; then
  1368. echo checking for sys/cpustats.h
  1369. cat > conftest.c <<EOF
  1370. #include <sys/cpustats.h>
  1371. EOF
  1372. err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
  1373. if test -z "$err"; then
  1374.   {
  1375. test -n "$verbose" && \
  1376. echo '    defining' UMAX
  1377. DEFS="$DEFS -DUMAX=1"
  1378. SEDDEFS="${SEDDEFS}\${SEDdA}UMAX\${SEDdB}UMAX\${SEDdC}1\${SEDdD}
  1379. \${SEDuA}UMAX\${SEDuB}UMAX\${SEDuC}1\${SEDuD}
  1380. \${SEDeA}UMAX\${SEDeB}UMAX\${SEDeC}1\${SEDeD}
  1381. "
  1382. }
  1383.  have_sym=1
  1384. fi
  1385. rm -f conftest*
  1386.  
  1387. fi
  1388. if test -z "$have_sym"; then
  1389. for hdr in mach/mach.h
  1390. do
  1391. trhdr=HAVE_`echo $hdr | tr '[a-z]./' '[A-Z]__'`
  1392. echo checking for ${hdr}
  1393. cat > conftest.c <<EOF
  1394. #include <${hdr}>
  1395. EOF
  1396. err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
  1397. if test -z "$err"; then
  1398.   {
  1399. test -n "$verbose" && \
  1400. echo '    defining' ${trhdr}
  1401. DEFS="$DEFS -D${trhdr}=1"
  1402. SEDDEFS="${SEDDEFS}\${SEDdA}${trhdr}\${SEDdB}${trhdr}\${SEDdC}1\${SEDdD}
  1403. \${SEDuA}${trhdr}\${SEDuB}${trhdr}\${SEDuC}1\${SEDuD}
  1404. \${SEDeA}${trhdr}\${SEDeB}${trhdr}\${SEDeC}1\${SEDeD}
  1405. "
  1406. }
  1407.  
  1408. fi
  1409. rm -f conftest*
  1410. done
  1411.  
  1412. fi
  1413. if test -z "$have_sym"; then
  1414. echo checking for nlist.h
  1415. cat > conftest.c <<EOF
  1416. #include <nlist.h>
  1417. EOF
  1418. err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
  1419. if test -z "$err"; then
  1420.   {
  1421. test -n "$verbose" && \
  1422. echo '    defining' NLIST_STRUCT
  1423. DEFS="$DEFS -DNLIST_STRUCT=1"
  1424. SEDDEFS="${SEDDEFS}\${SEDdA}NLIST_STRUCT\${SEDdB}NLIST_STRUCT\${SEDdC}1\${SEDdD}
  1425. \${SEDuA}NLIST_STRUCT\${SEDuB}NLIST_STRUCT\${SEDuC}1\${SEDuD}
  1426. \${SEDeA}NLIST_STRUCT\${SEDeB}NLIST_STRUCT\${SEDeC}1\${SEDeD}
  1427. "
  1428. }
  1429.  
  1430. echo checking for n_un in struct nlist
  1431. cat > conftest.c <<EOF
  1432. #include <nlist.h>
  1433. int main() { exit(0); }
  1434. int t() { struct nlist n; n.n_un.n_name = 0; }
  1435. EOF
  1436. if eval $compile; then
  1437.   {
  1438. test -n "$verbose" && \
  1439. echo '    defining' NLIST_NAME_UNION
  1440. DEFS="$DEFS -DNLIST_NAME_UNION=1"
  1441. SEDDEFS="${SEDDEFS}\${SEDdA}NLIST_NAME_UNION\${SEDdB}NLIST_NAME_UNION\${SEDdC}1\${SEDdD}
  1442. \${SEDuA}NLIST_NAME_UNION\${SEDuB}NLIST_NAME_UNION\${SEDuC}1\${SEDuD}
  1443. \${SEDeA}NLIST_NAME_UNION\${SEDeB}NLIST_NAME_UNION\${SEDeC}1\${SEDeD}
  1444. "
  1445. }
  1446.  
  1447. fi
  1448. rm -f conftest*
  1449.  
  1450. fi
  1451. rm -f conftest*
  1452. fi
  1453.  
  1454. # Figure out whether we will need to install setgid.
  1455. cat > conftest.c <<EOF
  1456. dnl
  1457. #include "${srcdir}/getloadavg.c"
  1458. #ifdef LDAV_PRIVILEGED
  1459. Yowza Am I SETGID yet
  1460. #endif
  1461. EOF
  1462. eval "$CPP \$DEFS conftest.c > conftest.out 2>&1"
  1463. if egrep "Yowza Am I SETGID yet" conftest.out >/dev/null 2>&1; then
  1464.   {
  1465. test -n "$verbose" && \
  1466. echo '    defining' GETLOADAVG_PRIVILEGED
  1467. DEFS="$DEFS -DGETLOADAVG_PRIVILEGED=1"
  1468. SEDDEFS="${SEDDEFS}\${SEDdA}GETLOADAVG_PRIVILEGED\${SEDdB}GETLOADAVG_PRIVILEGED\${SEDdC}1\${SEDdD}
  1469. \${SEDuA}GETLOADAVG_PRIVILEGED\${SEDuB}GETLOADAVG_PRIVILEGED\${SEDuC}1\${SEDuD}
  1470. \${SEDeA}GETLOADAVG_PRIVILEGED\${SEDeB}GETLOADAVG_PRIVILEGED\${SEDeC}1\${SEDeD}
  1471. "
  1472. }
  1473.  NEED_SETGID=true
  1474. fi
  1475. rm -f conftest*
  1476. ;;
  1477. esac
  1478.  
  1479. if $NEED_SETGID; then
  1480.   # Figure out what group owns /dev/kmem.
  1481.   # The installed program will need to be setgid and owned by that group.
  1482.   KMEM_GROUP=`ls -lg /dev/kmem |
  1483.           sed 's/^.[rwx-]*[     ]*[0-9]*[     ]*[^     ]*\
  1484. [     ]*\([^     ]*\)[     ].*$/\1/'`
  1485. fi
  1486.  
  1487. echo checking for strcoll
  1488. cat > conftest.c <<EOF
  1489. #include <string.h>
  1490. main ()
  1491. {
  1492.   exit (strcoll ("abc", "def") >= 0 ||
  1493.     strcoll ("ABC", "DEF") >= 0 ||
  1494.     strcoll ("123", "456") >= 0);
  1495. }
  1496. EOF
  1497. eval $compile
  1498. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  1499.   {
  1500. test -n "$verbose" && \
  1501. echo '    defining' HAVE_STRCOLL
  1502. DEFS="$DEFS -DHAVE_STRCOLL=1"
  1503. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_STRCOLL\${SEDdB}HAVE_STRCOLL\${SEDdC}1\${SEDdD}
  1504. \${SEDuA}HAVE_STRCOLL\${SEDuB}HAVE_STRCOLL\${SEDuC}1\${SEDuD}
  1505. \${SEDeA}HAVE_STRCOLL\${SEDeB}HAVE_STRCOLL\${SEDeC}1\${SEDeD}
  1506. "
  1507. }
  1508.  
  1509. fi
  1510. rm -f conftest*
  1511.  
  1512. for hdr in sys/wait.h
  1513. do
  1514. trhdr=HAVE_`echo $hdr | tr '[a-z]./' '[A-Z]__'`
  1515. echo checking for ${hdr}
  1516. cat > conftest.c <<EOF
  1517. #include <${hdr}>
  1518. EOF
  1519. err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
  1520. if test -z "$err"; then
  1521.   {
  1522. test -n "$verbose" && \
  1523. echo '    defining' ${trhdr}
  1524. DEFS="$DEFS -D${trhdr}=1"
  1525. SEDDEFS="${SEDDEFS}\${SEDdA}${trhdr}\${SEDdB}${trhdr}\${SEDdC}1\${SEDdD}
  1526. \${SEDuA}${trhdr}\${SEDuB}${trhdr}\${SEDuC}1\${SEDuD}
  1527. \${SEDeA}${trhdr}\${SEDeB}${trhdr}\${SEDeC}1\${SEDeD}
  1528. "
  1529. }
  1530.  
  1531. fi
  1532. rm -f conftest*
  1533. done
  1534.  for func in waitpid wait3
  1535. do
  1536. trfunc=HAVE_`echo $func | tr '[a-z]' '[A-Z]'`
  1537. echo checking for ${func}
  1538. cat > conftest.c <<EOF
  1539. #include <ctype.h>
  1540. int main() { exit(0); }
  1541. int t() { 
  1542. /* The GNU C library defines this for functions which it implements
  1543.     to always fail with ENOSYS.  Some functions are actually named
  1544.     something starting with __ and the normal name is an alias.  */
  1545. #if defined (__stub_${func}) || defined (__stub___${func})
  1546. choke me
  1547. #else
  1548. /* Override any gcc2 internal prototype to avoid an error.  */
  1549. extern char ${func}(); ${func}();
  1550. #endif
  1551.  }
  1552. EOF
  1553. if eval $compile; then
  1554.   {
  1555. test -n "$verbose" && \
  1556. echo '    defining' ${trfunc}
  1557. DEFS="$DEFS -D${trfunc}=1"
  1558. SEDDEFS="${SEDDEFS}\${SEDdA}${trfunc}\${SEDdB}${trfunc}\${SEDdC}1\${SEDdD}
  1559. \${SEDuA}${trfunc}\${SEDuB}${trfunc}\${SEDuC}1\${SEDuD}
  1560. \${SEDeA}${trfunc}\${SEDeB}${trfunc}\${SEDeC}1\${SEDeD}
  1561. "
  1562. }
  1563.  
  1564. fi
  1565. rm -f conftest*
  1566. done
  1567.  
  1568. echo checking for union wait
  1569. cat > conftest.c <<EOF
  1570. #include <sys/types.h>
  1571. #include <sys/wait.h>
  1572. int main() { exit(0); }
  1573. int t() { union wait status; int pid; pid = wait (&status);
  1574. #ifdef WEXITSTATUS
  1575. /* Some POSIXoid systems have both the new-style macros and the old
  1576.    union wait type, and they do not work together.  If union wait
  1577.    conflicts with WEXITSTATUS et al, we don't want to use it at all.  */
  1578. if (WEXITSTATUS (status) != 0) pid = -1;
  1579. #endif
  1580. #ifdef HAVE_WAITPID
  1581. /* Make sure union wait works with waitpid.  */
  1582. pid = waitpid (-1, &status, 0);
  1583. #endif
  1584.  }
  1585. EOF
  1586. if eval $compile; then
  1587.   {
  1588. test -n "$verbose" && \
  1589. echo '    defining' HAVE_UNION_WAIT
  1590. DEFS="$DEFS -DHAVE_UNION_WAIT=1"
  1591. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_UNION_WAIT\${SEDdB}HAVE_UNION_WAIT\${SEDdC}1\${SEDdD}
  1592. \${SEDuA}HAVE_UNION_WAIT\${SEDuB}HAVE_UNION_WAIT\${SEDuC}1\${SEDuD}
  1593. \${SEDeA}HAVE_UNION_WAIT\${SEDeB}HAVE_UNION_WAIT\${SEDeC}1\${SEDeD}
  1594. "
  1595. }
  1596.  
  1597. fi
  1598. rm -f conftest*
  1599.  
  1600.  
  1601. echo checking for sys_siglist declaration in signal.h
  1602. cat > conftest.c <<EOF
  1603. #include <signal.h>
  1604. int main() { exit(0); }
  1605. int t() { char *msg = *(sys_siglist + 1); }
  1606. EOF
  1607. if eval $compile; then
  1608.   {
  1609. test -n "$verbose" && \
  1610. echo '    defining' SYS_SIGLIST_DECLARED
  1611. DEFS="$DEFS -DSYS_SIGLIST_DECLARED=1"
  1612. SEDDEFS="${SEDDEFS}\${SEDdA}SYS_SIGLIST_DECLARED\${SEDdB}SYS_SIGLIST_DECLARED\${SEDdC}1\${SEDdD}
  1613. \${SEDuA}SYS_SIGLIST_DECLARED\${SEDuB}SYS_SIGLIST_DECLARED\${SEDuC}1\${SEDuD}
  1614. \${SEDeA}SYS_SIGLIST_DECLARED\${SEDeB}SYS_SIGLIST_DECLARED\${SEDeC}1\${SEDeD}
  1615. "
  1616. }
  1617.  
  1618. fi
  1619. rm -f conftest*
  1620.  
  1621.  
  1622. # The presence of the following is not meant to imply
  1623. # that make necessarily works on those systems.
  1624. echo checking for DYNIX/ptx libseq
  1625. cat > conftest.c <<EOF
  1626. #if defined(_SEQUENT_)
  1627.   yes
  1628. #endif
  1629.  
  1630. EOF
  1631. eval "$CPP \$DEFS conftest.c > conftest.out 2>&1"
  1632. if egrep "yes" conftest.out >/dev/null 2>&1; then
  1633.   SEQUENT=1
  1634. fi
  1635. rm -f conftest*
  1636.  
  1637. test -n "$SEQUENT" && test -f /usr/lib/libseq.a &&
  1638.   LIBS="$LIBS -lseq"
  1639.  
  1640. echo checking for Xenix
  1641. cat > conftest.c <<EOF
  1642. #if defined(M_XENIX) && !defined(M_UNIX)
  1643.   yes
  1644. #endif
  1645.  
  1646. EOF
  1647. eval "$CPP \$DEFS conftest.c > conftest.out 2>&1"
  1648. if egrep "yes" conftest.out >/dev/null 2>&1; then
  1649.   XENIX=1
  1650. fi
  1651. rm -f conftest*
  1652.  
  1653. if test -n "$XENIX"; then
  1654.   LIBS="$LIBS -lx"
  1655.   case "$DEFS" in
  1656.   *SYSNDIR*) ;;
  1657.   *) LIBS="-ldir $LIBS" ;; # Make sure -ldir precedes any -lx.
  1658.   esac
  1659. fi
  1660.  
  1661.  
  1662.  REMOTE=stub
  1663. # check whether --with-customs was given
  1664. if test -n "$with_customs"; then
  1665.   REMOTE=cstms
  1666. LIBS="$LIBS libcustoms.a"
  1667. fi
  1668.  
  1669.  
  1670. echo checking for location of SCCS get command
  1671. if test -f /usr/sccs/get; then
  1672.   {
  1673. test -n "$verbose" && \
  1674. echo '    defining' SCCS_GET to be '"/usr/sccs/get"'
  1675. DEFS="$DEFS -DSCCS_GET=\"/usr/sccs/get\""
  1676. SEDDEFS="${SEDDEFS}\${SEDdA}SCCS_GET\${SEDdB}SCCS_GET\${SEDdC}\"/usr/sccs/get\"\${SEDdD}
  1677. \${SEDuA}SCCS_GET\${SEDuB}SCCS_GET\${SEDuC}\"/usr/sccs/get\"\${SEDuD}
  1678. \${SEDeA}SCCS_GET\${SEDeB}SCCS_GET\${SEDeC}\"/usr/sccs/get\"\${SEDeD}
  1679. "
  1680. }
  1681.  
  1682. else
  1683.   {
  1684. test -n "$verbose" && \
  1685. echo '    defining' SCCS_GET to be '"get"'
  1686. DEFS="$DEFS -DSCCS_GET=\"get\""
  1687. SEDDEFS="${SEDDEFS}\${SEDdA}SCCS_GET\${SEDdB}SCCS_GET\${SEDdC}\"get\"\${SEDdD}
  1688. \${SEDuA}SCCS_GET\${SEDuB}SCCS_GET\${SEDuC}\"get\"\${SEDuD}
  1689. \${SEDeA}SCCS_GET\${SEDeB}SCCS_GET\${SEDeC}\"get\"\${SEDeD}
  1690. "
  1691. }
  1692.  
  1693. fi
  1694.  
  1695. if test -n "$prefix"; then
  1696.   test -z "$exec_prefix" && exec_prefix='${prefix}'
  1697.   prsub="s%^prefix\\([     ]*\\)=\\([     ]*\\).*$%prefix\\1=\\2$prefix%"
  1698. fi
  1699. if test -n "$exec_prefix"; then
  1700.   prsub="$prsub
  1701. s%^exec_prefix\\([     ]*\\)=\\([     ]*\\).*$%\
  1702. exec_prefix\\1=\\2$exec_prefix%"
  1703. fi
  1704. DEFS="`echo \"$DEFS\" | sed 's%[&\\\]%\\\&%g'`"
  1705.  
  1706. trap 'rm -f config.status; exit 1' 1 3 15
  1707. echo creating config.status
  1708. rm -f config.status
  1709. cat > config.status <<EOF
  1710. #!/bin/sh
  1711. # Generated automatically by configure.
  1712. # Run this file to recreate the current configuration.
  1713. # This directory was configured as follows,
  1714. # on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
  1715. #
  1716. # $0 $*
  1717.  
  1718. for arg
  1719. do
  1720.   case "\$arg" in
  1721.     -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
  1722.     exec /bin/sh $0 $* ;;
  1723.     *) echo "Usage: config.status --recheck" 2>&1; exit 1 ;;
  1724.   esac
  1725. done
  1726.  
  1727. trap 'rm -f Makefile build.sh glob/Makefile config.h conftest*; exit 1' 1 3 15
  1728. CFLAGS='$CFLAGS'
  1729. LDFLAGS='$LDFLAGS'
  1730. CC='$CC'
  1731. INSTALL='$INSTALL'
  1732. INSTALL_PROGRAM='$INSTALL_PROGRAM'
  1733. INSTALL_DATA='$INSTALL_DATA'
  1734. RANLIB='$RANLIB'
  1735. CPP='$CPP'
  1736. LIBOBJS='$LIBOBJS'
  1737. ALLOCA='$ALLOCA'
  1738. NEED_SETGID='$NEED_SETGID'
  1739. KMEM_GROUP='$KMEM_GROUP'
  1740. REMOTE='$REMOTE'
  1741. LIBS='$LIBS'
  1742. srcdir='$srcdir'
  1743. prefix='$prefix'
  1744. exec_prefix='$exec_prefix'
  1745. prsub='$prsub'
  1746. EOF
  1747. cat >> config.status <<\EOF
  1748.  
  1749. top_srcdir=$srcdir
  1750.  
  1751. # Allow make-time overrides of the generated file list.
  1752. test -n "$gen_files" || gen_files="Makefile build.sh glob/Makefile"
  1753.  
  1754. for file in .. $gen_files; do if [ "x$file" != "x.." ]; then
  1755.   srcdir=$top_srcdir
  1756.   # Remove last slash and all that follows it.  Not all systems have dirname.
  1757.   dir=`echo $file|sed 's%/[^/][^/]*$%%'`
  1758.   if test "$dir" != "$file"; then
  1759.     test "$top_srcdir" != . && srcdir=$top_srcdir/$dir
  1760.     test ! -d $dir && mkdir $dir
  1761.   fi
  1762.   echo creating $file
  1763.   rm -f $file
  1764.   echo "# Generated automatically from `echo $file|sed 's|.*/||'`.in by configure." > $file
  1765.   sed -e "
  1766. $prsub
  1767. s%@CFLAGS@%$CFLAGS%g
  1768. s%@LDFLAGS@%$LDFLAGS%g
  1769. s%@CC@%$CC%g
  1770. s%@INSTALL@%$INSTALL%g
  1771. s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
  1772. s%@INSTALL_DATA@%$INSTALL_DATA%g
  1773. s%@RANLIB@%$RANLIB%g
  1774. s%@CPP@%$CPP%g
  1775. s%@LIBOBJS@%$LIBOBJS%g
  1776. s%@ALLOCA@%$ALLOCA%g
  1777. s%@NEED_SETGID@%$NEED_SETGID%g
  1778. s%@KMEM_GROUP@%$KMEM_GROUP%g
  1779. s%@REMOTE@%$REMOTE%g
  1780. s%@LIBS@%$LIBS%g
  1781. s%@srcdir@%$srcdir%g
  1782. s%@DEFS@%-DHAVE_CONFIG_H%" $top_srcdir/${file}.in >> $file
  1783. fi; done
  1784. test -n "$gen_config" || gen_config=config.h
  1785. echo creating $gen_config
  1786. # These sed commands are put into SEDDEFS when defining a macro.
  1787. # They are broken into pieces to make the sed script easier to manage.
  1788. # They are passed to sed as "A NAME B NAME C VALUE D", where NAME
  1789. # is the cpp macro being defined and VALUE is the value it is being given.
  1790. # Each defining turns into a single global substitution command.
  1791. #
  1792. # SEDd sets the value in "#define NAME VALUE" lines.
  1793. SEDdA='s@^\([     ]*\)#\([     ]*define[     ][     ]*\)'
  1794. SEDdB='\([     ][     ]*\)[^     ]*@\1#\2'
  1795. SEDdC='\3'
  1796. SEDdD='@g'
  1797. # SEDu turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
  1798. SEDuA='s@^\([     ]*\)#\([     ]*\)undef\([     ][     ]*\)'
  1799. SEDuB='\([     ]\)@\1#\2define\3'
  1800. SEDuC=' '
  1801. SEDuD='\4@g'
  1802. # SEDe turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
  1803. SEDeA='s@^\([     ]*\)#\([     ]*\)undef\([     ][     ]*\)'
  1804. SEDeB='$@\1#\2define\3'
  1805. SEDeC=' '
  1806. SEDeD='@g'
  1807. rm -f conftest.sed
  1808. EOF
  1809. # Turn off quoting long enough to insert the sed commands.
  1810. rm -f conftest.sh
  1811. cat > conftest.sh <<EOF
  1812. $SEDDEFS
  1813. EOF
  1814.  
  1815. # Maximum number of lines to put in a single here document.
  1816. maxshlines=9
  1817.  
  1818. # Break up $SEDDEFS (now in conftest.sh) because some shells have a limit
  1819. # on the size of here documents.
  1820.  
  1821. while :
  1822. do
  1823.   lines=`grep -c . conftest.sh`
  1824.   if test -z "$lines" || test "$lines" -eq 0; then break; fi
  1825.   rm -f conftest.s1 conftest.s2
  1826.   sed ${maxshlines}q conftest.sh > conftest.s1 # Like head -20.
  1827.   sed 1,${maxshlines}d conftest.sh > conftest.s2 # Like tail +21.
  1828.   # Write a limited-size here document to append to conftest.sed.
  1829.   echo 'cat >> conftest.sed <<CONFEOF' >> config.status
  1830.   cat conftest.s1 >> config.status
  1831.   echo 'CONFEOF' >> config.status
  1832.   rm -f conftest.s1 conftest.sh
  1833.   mv conftest.s2 conftest.sh
  1834. done
  1835. rm -f conftest.sh
  1836.  
  1837. # Now back to your regularly scheduled config.status.
  1838. cat >> config.status <<\EOF
  1839. # This sed command replaces #undef's with comments.  This is necessary, for
  1840. # example, in the case of _POSIX_SOURCE, which is predefined and required
  1841. # on some systems where configure will not decide to define it in
  1842. # config.h.
  1843. cat >> conftest.sed <<\CONFEOF
  1844. s,^[     ]*#[     ]*undef[     ][     ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */,
  1845. CONFEOF
  1846. rm -f conftest.h
  1847. # Break up the sed commands because old seds have small limits.
  1848. maxsedlines=20
  1849. cp $top_srcdir/$gen_config.in conftest.h1
  1850. while :
  1851. do
  1852.   lines=`grep -c . conftest.sed`
  1853.   if test -z "$lines" || test "$lines" -eq 0; then break; fi
  1854.   rm -f conftest.s1 conftest.s2 conftest.h2
  1855.   sed ${maxsedlines}q conftest.sed > conftest.s1 # Like head -20.
  1856.   sed 1,${maxsedlines}d conftest.sed > conftest.s2 # Like tail +21.
  1857.   sed -f conftest.s1 < conftest.h1 > conftest.h2
  1858.   rm -f conftest.s1 conftest.h1 conftest.sed
  1859.   mv conftest.h2 conftest.h1
  1860.   mv conftest.s2 conftest.sed
  1861. done
  1862. rm -f conftest.sed conftest.h
  1863. echo "/* $gen_config.  Generated automatically by configure.  */" > conftest.h
  1864. cat conftest.h1 >> conftest.h
  1865. rm -f conftest.h1
  1866. if cmp -s $gen_config conftest.h 2>/dev/null; then
  1867.   # The file exists and we would not be changing it.
  1868.   rm -f conftest.h
  1869. else
  1870.   rm -f $gen_config
  1871.   mv conftest.h $gen_config
  1872. fi
  1873.  
  1874.  
  1875. exit 0
  1876. EOF
  1877. chmod +x config.status
  1878. test -n "$no_create" || ./config.status
  1879.  
  1880.  
  1881.